<template>
	<view class="about">
		<!-- <view v-if="hasLogin"> -->
		<!-- 导航 -->
		<!-- <u-navbar
			back-text="支付结果"
			:back-text-style="textStyle"
			back-icon-color="#000000"
			style="font-weight: bold;font-family: PingFang SC;"
		></u-navbar> -->
		<!-- <u-navbar back-icon-color="#000000" title="订单" title-color="#3F3F3F" :title-bold="true" :background="background" :custom-back="customBack"></u-navbar> -->
		<!-- end -->
		<!-- 	<view class="middle">
			<view class="icon">
				<image src="../../static/icon/pay.png" mode="" v-if="type == 1"></image>
				<image src="../../static/icon/pay1.png" mode="" v-else></image>
				<view class="banben" v-if="type == 1">
				支付成功
				</view>
				<view class="banben" v-else>
				支付失败
				</view>
			</view>
			<view style="margin-top: 230rpx;text-align: center;" v-if="type ==1">
				<u-button type="warning" shape="circle" size="medium" plain @click="dingdan()">查看订单</u-button>
			</view>
		</view> -->

		<view style="width: 100%;height:10rpx ;background-color: #F1F1F1;"></view>
		<view style="border-bottom: 1px solid #E4E4E4; width: 100%;display: flex;align-items: center;justify-content: center;padding-top: 50rpx;padding-bottom:36rpx ;">
			<image style="width: 68rpx;height: 70rpx;" src="../../static/gx_img/pay_scuss.png"></image>
			<view style="font-size: 40rpx;color: #3F3F3F;margin-left: 15rpx;">{{type == 3?'拼团成功！平台已通知商家':'购买成功！平台已通知商家'}}</view>
		</view>
		<view v-if="type == 3"  style="display: flex;align-items: center;justify-content: center;margin: 40rpx 0;">
			<view >
				<image style="width: 120rpx;height: 120rpx;border-radius: 50%;" 
				:src="details.groupLeaderPortrait?details.groupLeaderPortrait:'https://beedao.oss-cn-beijing.aliyuncs.com/9ca4c3b0d041409e9e4c3d41b896430b.png' " mode=""></image>
			</view>
			<view style="margin-left: -18rpx;">
				<image style="width: 120rpx;height: 120rpx;border-radius: 50%;" :src="details.joinPortrait?details.joinPortrait:'https://beedao.oss-cn-beijing.aliyuncs.com/9ca4c3b0d041409e9e4c3d41b896430b.png'" mode=""></image>
			</view>
		</view>
		<view style="width: 90%;margin: auto;padding: 25rpx 0rpx;">
			<view @tap="jump()" style="width: 100%;overflow: hidden;">
				<view style="float: left;">
					<view style="display: flex;align-items: center;">
						<image style="width: 38rpx;height: 38rpx;" :src="details.enterpriseImage"></image>
						<view style="font-size: 30rpx;color: #3F3F3F;margin-left: 10rpx;font-weight: 400;">{{details.enterpriseName}}</view>
					</view>
				</view>
				<view style="float: right;"><u-icon style="font-size: 35rpx;color:  #000000;opacity: 0.8;" name="arrow-right"></u-icon></view>
			</view>
			<view @tap="xingqing()" style="width: 100%;margin-top: 20rpx;display: flex;align-items: center;justify-content: space-between;">
				<view style="font-size: 30rpx;color: #3F3F3F;font-weight: 400; ">订单编号：{{details.orderCode}}</view>
				<view style=""><u-icon style="font-size: 35rpx;color:  #000000;opacity: 0.8;" name="arrow-right"></u-icon></view>
			</view>
		</view>
		<view style="width: 100%;height:10rpx ;background-color: #F1F1F1;"></view>
		<view style="width: 90%;margin:0 auto;padding-top: 22rpx;padding-bottom: 22rpx;">
			<view style="color: #3F3F3F;font-size: 30rpx;font-weight: bold;">服务码</view>
			<view style="color:#BFBFBF ;font-size: 26rpx;line-height: 50rpx;padding-bottom: 40rpx;">可使用（1次）服务结束后请主动出示此服务码</view>
			<view style="width: 276rpx;height: 276rpx;margin:0 auto;">
				<tki-qrcode
					cid="qrcode1"
					ref="qrcode"
					:val="val"
					:size="size"
					:unit="unit"
					:background="background"
					:foreground="foreground"
					:pdground="pdground"
					:icon="icon"
					:iconSize="iconsize"
					:lv="lv"
					:onval="onval"
					:loadMake="loadMake"
					:usingComponents="true"
				/>
			</view>
			<view style="font-size: 36rpx;color: #000000;font-weight: bold;text-align: center;">服务码：{{details.verificationCode}}</view>

			<view style=" font-size: 26rpx;color: #000000;text-align: center;line-height: 60rpx;">服务前请拒绝向商家提供服务码</view>
		</view>
		<view style="width: 100%;height:10rpx ;background-color: #F1F1F1;"></view>

		<view @tap="finsh()"
			style="margin:70rpx auto ; width: 276rpx;text-align: center;font-size: 30rpx;height: 84rpx;background: #FFFFFF;border:2rpx solid #F29423;opacity: 1;border-radius: 10rpx;font-weight: bold;line-height: 84rpx;color: #F29423;"
		>
			完成
		</view>
	</view>
</template>

<script>
import tkiQrcode from '../../components/tki-qrcode/tki-qrcode.vue';
export default {
	components: {
		tkiQrcode
	},
	data() {
		return {
			size: 250, // 二维码大小
			unit: 'upx', // 单位
			background: '#fff', // 背景色
			foreground: '#000', // 前景色
			pdground: '#000', // 角标色
			is_click: true,
			iconsize: 40, // 二维码图标大小
			lv: 3, // 二维码容错级别 ， 一般不用设置，默认就行
			onval: true, // val值变化时自动重新生成二维码
			loadMake: true, // 组件加载完成后自动生成二维码
			orderId: '',
			type: 0,
			taocan: '',
			details: '',
			val_code:'',
			val: null
		};
	},
	onLoad(option) {
		this.type = option.type;
		this.taocan = option.taocan;
		let pages = getCurrentPages(); //获取所有页面栈实例列表
		let prevPage = pages[pages.length - 2]; //上一页页面实例
		let prevPages = pages[pages.length - 3]; //上一页页面实例
		if(prevPage){
			prevPage.$vm.isMade = 1; //修改上一页data里面的sh参数值为100
		}
		if(prevPages){
			prevPages.$vm.isMade = 1; //修改上一页data里面的sh参数值为100
		}
		// 如果是套餐订单 支付过后返回1
		//this.type, '支付成功type=1;
		this.orderId = option.orderId;
		this.orderDetail(option.orderId)
	},
	methods: {
		xingqing(){
			uni.navigateTo({
				url:'/pageageA/order/orderDetail?orderId='+this.orderId
			})
		},
		finsh(){
			uni.redirectTo({
				url:'/pages/order/index2?type='+''
			})
		},
		jump(){
			uni.navigateTo({
				url:'/pageageA/home/shopDetails/shopDetails?enterpriseId='+this.details.enterpriseId
			})
		
		},
		//订单详情
		orderDetail(id) {
			let _this = this;
			let opts = {
				way: true, //true JSON请求；false 表单请求
				method: 'post',
				url: 'unit-orders/pay/success/info'
			};
			let data = {
				orderId: id
			};
			_this.http.httpTokenRequest(opts, data).then(res => {
				_this.details = res.data;
				if(_this.details.verificationCode){
					_this.val_code= res.data.verificationCode;
					console.log(_this.val_code )
					_this.val=JSON.stringify({
						orderId:_this.orderId,
						code:_this.val_code
					});
				}
				
			});
		},
		dingdan() {
			if (this.taocan == 1) {
				uni.navigateTo({
					url: '../order/tuangouDetail?orderId=' + this.orderId
				});
			} else {
				uni.navigateTo({
					url: '../order/orderDetail?orderId=' + this.orderId
				});
			}
		}
	}
};
</script>

<style scoped lang="scss">
.about {
	background-color: white;
	font-family: PingFang SC;
}
.icon {
	padding-top: 260rpx;
	text-align: center;
}

.icon image {
	width: 151px;
	height: 138px;
}
.banben {
	font-family: PingFang SC;
	color: #3f3f3f;
	font-size: 40rpx;
	font-weight: bold;
	padding-top: 44rpx;
}
</style>
